--- libaacs-0.8.1/src/libaacs/crypto.c
+++ libaacs-0.8.1/src/libaacs/crypto.c
@@ -37,6 +37,7 @@
 
 #ifdef HAVE_PTHREAD_H
 #if GCRYPT_VERSION_NUMBER < 0x010600
+#include <errno.h>
 #include <pthread.h>
 #endif
 #endif
